package cn.ml.springmybatis1.service;

import cn.ml.springmybatis1.entity.XueYuan;
import cn.ml.springmybatis1.entity.XueYuanExample;
import cn.ml.springmybatis1.mapper.XueYuanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service

public class XueYuanServiceImpl implements XueYuanService{
    //111.按类型注入直接注入
    @Autowired
    //222.按名称注入与xml中id相对应
    //@Resource(name = "sMapper")
    private XueYuanMapper xueYuanMapper;
    @Override
    public void save(XueYuan xueYuan) {
        xueYuanMapper.insert(xueYuan);
    }

    @Override
    public void delete(int id) {
        xueYuanMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(XueYuan xueYuan) {
        xueYuanMapper.updateByPrimaryKey(xueYuan);
    }

    @Override
    public List<XueYuan> list(XueYuanExample example) {
        return xueYuanMapper.selectByExample(example);
    }
}
